﻿@model DotaHelp.Models.Guide

@{
    ViewBag.Title = "Добавить гайд для "+ViewBag.Hero.Name+" на Dotahelp.ru";
    ViewBag.Meta_description = "Написать свой гайд для "+ViewBag.Hero.Name;
    ViewBag.Meta_keywords = "DotaHelp, dota, гайд, добавить, написать, " + ViewBag.Hero.Name;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@Html.LinkOnHero((Hero)ViewBag.Hero)  Добавить гайд для @ViewBag.Hero.Name</h2>



<script type="text/javascript">

    $(function () {
        CKEDITOR.replace('GuideText_Text'); 
    });

</script>

@using (Ajax.BeginForm("Add", "Guides", new { id = Model.Id, heroId = ViewBag.Hero.Id }, new AjaxOptions() { OnComplete = "OnComplete" }))
{
    if (!Request.IsAuthenticated)
    { 
        <div>
            @Html.GenerateCaptcha()
        </div>
    }
    @Html.ValidationSummary(true) 
    

    <table>
        <tr class="editor-label">
            <td>@Html.LabelFor(m => m.Title)</td>
            @if (User.IsInRole("Admin"))
            {<td>@Html.LabelFor(m => m.Source) (Url)</td>}
            <td>@Html.LabelFor(m => m.Author)</td>
            <td>@Html.LabelFor(m => m.Password)</td>
            <td>@Html.LabelFor(m => m.Version)</td>
            <td>@Html.LabelFor(m => m.LangId)</td>
        </tr>
        <tr>
            <td class="editor-field"> 
                @Html.EditorFor(model => model.Title)
                
             </td>
             @if (User.IsInRole("Admin"))
             {
                 <td class="editor-field"> 
                    @Html.EditorFor(model => model.Source)                   
                 </td>
             }
             <td class="editor-field"> 
                @Html.EditorFor(model => model.Author)               
             </td>
             <td class="editor-field"> 
                @Html.PasswordFor(model => model.Password)               
             </td>
             <td class="editor-field"> 
                @Html.EditorFor(model => model.Version, new { style = "width:40px" })               
             </td>
             <td class="editor-field"> 
               @Html.DropDownListFor(model => model.LangId, new[]{
                    new SelectListItem(){ Selected = true, Text ="Русский", Value = "1"},
                    new SelectListItem(){ Text ="Английский", Value = "2"}
                })                
             </td>
        </tr>
    </table>  
    <div>@Html.ValidationMessageFor(model => model.Title)</div>
    <div>@Html.ValidationMessageFor(model => model.Source)</div>
    <div>@Html.ValidationMessageFor(model => model.Author)</div>
    <div>@Html.ValidationMessageFor(model => model.Password)</div>
    <div>@Html.ValidationMessageFor(model => model.Version)</div>
    <div>@Html.ValidationMessageFor(model => model.LangId)</div>    
   
    <div class="editor-field">
        @Html.TextAreaFor(model => model.GuideText.Text, new { rows = 150, cols = 80 })
        @Html.ValidationMessageFor(model => model.GuideText.Text)
    </div>
    
    <p>
        <input type="submit" value="Добавить / Сохранить" />
    </p>
   
}


<h3 >Помощь в составлении гайдов:</h3>

@Html.Comments("Добавление гайдов", Url.Action("ChooseHero"), (int) ViewBag.Hero.AvatarImageId)
